Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RecoverWith): add recoverWith Operator #260

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

srijan02420
Copy link

No description provided.

@coveralls
Copy link

coveralls commented Oct 12, 2018

Coverage Status

Coverage increased (+0.4%) to 88.816% when pulling 561bafb on srijan02420:feat/capture into 711f669 on tusharmath:master.

@srijan02420 srijan02420 changed the title feat(Capture): add Capture Operator feat(RecoverWith): add recoverWith Operator Oct 12, 2018
next(401, -1),
next(402, -1),
complete(405)
])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write a marble test instead.


next(val: T): void {
this.sink.next(val)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use a mixen for this


export type TSource<T> = IObservable<T>
export type TResult<R> = IObservable<R>
export type TMapper<T> = (err: Error) => T
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T should be an observable here. Once the values are recovered there is no way to detect if the returned observable carries a value or an error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tusharmath you mean source should be observable of observable?

describe('recoverWith()', () => {
it('should only emit errors as data', () => {
const sh = createTestScheduler()
const $ = sh.Cold<number>([
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need tests for when the subscription starts and when it ends.

EVENT.next(403, 'b'),
EVENT.next(407, 'c'),
EVENT.next(411, 'd'),
EVENT.next(604, 'z'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as an error is dispatched. The subscription should end. So even though the stream is firing c-#-d it should not be captured by the observer. This is a fundamental architectural assumption that is being made for all other operators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants